Belgelerim/ceng_491/implementation/doxygen/TraffEdu_Developers_Manual_Reference_ToSource/CommandTranslate.cpp

Go to the documentation of this file.
00001 
00002 CommandTranslate::CommandTranslate(TraffEduObject* obj, osg::Vec3 old_position,osg::Vec3 new_position,OSGWindows* osgwind)
00003 {
00004         osgwind_=osgwind;
00005         obj_ = obj;
00006         old_position_ = old_position;
00007         new_position_ = new_position;
00008         translatedObjs_.push_back(obj);
00009         first_entrance=0;
00010 }
00011 
00012 bool CommandTranslate::execute()
00013 {
00014         int size=(int)translatedObjs_.size();
00015         for(int i=0;i<size;i++)
00016         {
00017                 if(first_entrance)
00018                 translatedObjs_.at(i)->setPosition(new_position_.x(),new_position_.y(),new_position_.z());
00019                 first_entrance = 1;
00020         }
00021         return true;
00022 }
00023 
00024 bool CommandTranslate::unexecute()
00025 {
00026         int size=(int)translatedObjs_.size();
00027         for(int i=0;i<size;i++)
00028         {
00029                 translatedObjs_.at(i)->setPosition(old_position_.x(),old_position_.y(),0.0);
00030                 
00031         }
00032         return true;
00033 }

Generated on Sun May 28 18:54:09 2006 for TraffEdu by  doxygen 1.4.6-NO